package com.ruoyi.system.api.factory;


import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteProjectResearchService;
import com.ruoyi.system.api.domain.ProjectResearch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteProjectResearchFallbackFactory implements FallbackFactory<RemoteProjectResearchService> {
    private static final Logger log= LoggerFactory.getLogger(RemoteProjectResearchFallbackFactory.class);
    @Override
    public RemoteProjectResearchService create(Throwable throwable) {
        log.error("科研项目服务调用失败:{}",throwable.getMessage());
        System.out.println("科研项目服务调用失败:"+throwable.getMessage());
        return new RemoteProjectResearchService() {
            @Override
            public R<ProjectResearch> getProjectInfo(Long projectId) {
                return R.fail("获取科研项目信息失败:"+throwable.getMessage());
            }
        };
    }
}
